package com.hdoit.ares.web.share.modelconfig;
import com.hdoit.ares.web.share.providers.ShareInfoStateProvider;
import com.hdoit.ares.web.share.providers.ViewTimeStateProvider;
import com.tennetcn.common.enums.regular.MathRegularExpressions;
import com.tennetcn.component.attribute.DisplayNameAttribute;
import com.tennetcn.component.attribute.DropDownListAttribute;
import com.tennetcn.component.attribute.RegularExpressionAttribute;
import com.tennetcn.component.attribute.RequiredAttribute;
import com.tennetcn.component.attribute.base.ModelMetadataAttributeConfiguration;

/**
 * @author      wangxuexue
 * @email       
 * @createtime  2017年11月22日 15:43:02
 * @comment
 */
public class ShareInfoConfig extends ModelMetadataAttributeConfiguration{
    public ShareInfoConfig(){
        this.setProperty("infoTitle")
            .hasAttribute(new DisplayNameAttribute("咨讯标题"))
        .hasAttribute(new RequiredAttribute("咨讯标题为必填项"));

        this.setProperty("infoAuthor")
            .hasAttribute(new DisplayNameAttribute("咨讯作者"));

        this.setProperty("infoContent")
            .hasAttribute(new DisplayNameAttribute("咨讯内容"));

        this.setProperty("infoType")
            .hasAttribute(new DisplayNameAttribute("咨讯类型"))
            .hasAttribute(new RegularExpressionAttribute(MathRegularExpressions.naturalNumber))
        .hasAttribute(new DropDownListAttribute(new ShareInfoStateProvider()));
        
        this.setProperty("infoThumbnailId")
            .hasAttribute(new DisplayNameAttribute("资讯缩略图"));

        this.setProperty("infoBigpictureId")
            .hasAttribute(new DisplayNameAttribute("资讯大图"));

        this.setProperty("sortCode")
            .hasAttribute(new DisplayNameAttribute("排序代码"))
            .hasAttribute(new RegularExpressionAttribute(MathRegularExpressions.naturalNumber));

        this.setProperty("createBy")
            .hasAttribute(new DisplayNameAttribute("创建人"));

        this.setProperty("modifyBy")
            .hasAttribute(new DisplayNameAttribute("修改人"));

        this.setProperty("code")
            .hasAttribute(new DisplayNameAttribute("全拼"));

        this.setProperty("markCode")
            .hasAttribute(new DisplayNameAttribute("连拼"));

        this.setProperty("viewTimes.type")
        .hasAttribute(new DisplayNameAttribute("资源类型"))
        .hasAttribute(new DropDownListAttribute(new ViewTimeStateProvider()));

        this.setProperty("viewTimes.viewtimes")
        .hasAttribute(new DisplayNameAttribute("浏览次数"))
        .hasAttribute(new RegularExpressionAttribute(MathRegularExpressions.naturalNumber));
    }
}